package week2;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/**
 * @author The Setting sun
 * @create 2021-09-16 16:55
 */
public class work3 {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                if (e.getKeyCode() == Event.ENTER){
                    System.exit(1);
                }

            }
        });
        frame.setSize(500, 450);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}
